package com.xingyue;

import com.xingyue.base.core.StatusCode;
import com.xingyue.base.exception.FailCodeException;
import com.xingyue.base.request.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by binbin on 2017/7/23.
 */
@SpringBootApplication
@ServletComponentScan
@RestController
@ImportResource("classpath:spring-ctx.xml")
public class Application {
    private static Logger logger = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(Application.class);
        app.run(args);
    }

    @RequestMapping(value = "/**", method = RequestMethod.GET)
    public Response indexGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        throw new FailCodeException(StatusCode.API_Fail);
    }

    @RequestMapping(value = "/**", method = RequestMethod.POST)
    public Response indexPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        throw new FailCodeException(StatusCode.API_Fail);
    }
}
